package com.pureut.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pureut.common.security.utils.SecurityUtils;
import com.pureut.system.domain.InformationEntry;
import com.pureut.system.domain.vo.InformationEntryVo;
import com.pureut.system.mapper.InformationEntryMapper;
import com.pureut.system.service.IInformationEntryService;
import org.apache.catalina.security.SecurityUtil;
import org.springframework.stereotype.Service;
import java.util.Date;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;

/**
 * @Author: pureut
 * @Date: 2025-04-08 16:25:49
 * @Desc: 信息录入表
 */
@Service("informationEntryService")
public class InformationEntryServiceImpl extends ServiceImpl<InformationEntryMapper, InformationEntry> implements IInformationEntryService {

    /**
     * 信息录入表Dao
     */
    @Resource
    private InformationEntryMapper informationEntryMapper;




    /**
     * 新增信息录入表
     * @param informationEntryVo
     * @return
     */
    @Override
    public Boolean save(InformationEntryVo informationEntryVo) {
        InformationEntry informationEntry = new InformationEntry();
        BeanUtil.copyProperties(informationEntryVo, informationEntry);
        informationEntry.setCreateBy(SecurityUtils.getUsername());

        informationEntry.setCreateTime(new Date());
        return save(informationEntry);
    }


    /**
     * 更新信息录入表
     * @param informationEntryVo
     * @return
     */
    @Override
    public Boolean updateById(InformationEntryVo informationEntryVo) {
        InformationEntry informationEntry = new InformationEntry();
        BeanUtil.copyProperties(informationEntryVo, informationEntry);
        informationEntry.setUpdateBy(SecurityUtils.getUsername());

        informationEntry.setUpdateTime(new Date());
        return updateById(informationEntry);
    }
}
